/*
 *   Copyright (C) @2021 Webank Group Holding Limited
 *   <p>
 *   Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 *  in compliance with the License. You may obtain a copy of the License at
 *  <p>
 *  http://www.apache.org/licenses/LICENSE-2.0
 *   <p>
 *   Unless required by applicable law or agreed to in writing, software distributed under the License
 *   is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 *  or implied. See the License for the specific language governing permissions and limitations under
 *  he License.
 *
 */

package com.webank.openledger.contracts.storage;

import java.math.BigInteger;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.fisco.bcos.sdk.abi.FunctionReturnDecoder;
import org.fisco.bcos.sdk.abi.TypeReference;
import org.fisco.bcos.sdk.abi.datatypes.Bool;
import org.fisco.bcos.sdk.abi.datatypes.DynamicArray;
import org.fisco.bcos.sdk.abi.datatypes.DynamicBytes;
import org.fisco.bcos.sdk.abi.datatypes.Function;
import org.fisco.bcos.sdk.abi.datatypes.Type;
import org.fisco.bcos.sdk.abi.datatypes.generated.Uint256;
import org.fisco.bcos.sdk.abi.datatypes.generated.tuples.generated.Tuple1;
import org.fisco.bcos.sdk.abi.datatypes.generated.tuples.generated.Tuple2;
import org.fisco.bcos.sdk.abi.datatypes.generated.tuples.generated.Tuple3;
import org.fisco.bcos.sdk.client.Client;
import org.fisco.bcos.sdk.contract.Contract;
import org.fisco.bcos.sdk.crypto.CryptoSuite;
import org.fisco.bcos.sdk.crypto.keypair.CryptoKeyPair;
import org.fisco.bcos.sdk.model.CryptoType;
import org.fisco.bcos.sdk.model.TransactionReceipt;
import org.fisco.bcos.sdk.model.callback.TransactionCallback;
import org.fisco.bcos.sdk.transaction.model.exception.ContractException;

@SuppressWarnings("unchecked")
public class Storage extends Contract {
    public static final String[] BINARY_ARRAY = {"608060405234801561001057600080fd5b5061001961007b565b604051809103906000f080158015610035573d6000803e3d6000fd5b50600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061008c565b6040516108cb806200237783390190565b6122db806200009c6000396000f3006080604052600436106100f1576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630adcaddc146100f657806320ba5b60146101335780633209c6de146101705780633b007d8e1461019b5780633ffe4585146101d85780634dbf1fd81461020357806353ed51431461024257806358edef4c1461026e5780635ac84216146102ab5780635e331e62146102e857806370603cee14610326578063949d225d146103635780639ee316e71461038e578063a18c751e146103cb578063ca34a0e314610408578063d6d7d52514610445578063d7ecbbcc14610482575b600080fd5b34801561010257600080fd5b5061011d60048036036101189190810190611de6565b6104bf565b60405161012a9190612059565b60405180910390f35b34801561013f57600080fd5b5061015a60048036036101559190810190611d7a565b6104d2565b6040516101679190612059565b60405180910390f35b34801561017c57600080fd5b5061018561089f565b6040516101929190612119565b60405180910390f35b3480156101a757600080fd5b506101c260048036036101bd9190810190611d7a565b6108cf565b6040516101cf9190612059565b60405180910390f35b3480156101e457600080fd5b506101ed610ac6565b6040516101fa9190612074565b60405180910390f35b34801561020f57600080fd5b5061022a60048036036102259190810190611e0f565b610b21565b6040516102399392919061201b565b60405180910390f35b34801561024e57600080fd5b50610257610c26565b604051610265929190611feb565b60405180910390f35b34801561027a57600080fd5b5061029560048036036102909190810190611d39565b610c4e565b6040516102a29190612059565b60405180910390f35b3480156102b757600080fd5b506102d260048036036102cd9190810190611d39565b610f0f565b6040516102df9190612059565b60405180910390f35b3480156102f457600080fd5b5061030f600480360361030a9190810190611de6565b610f8b565b60405161031d929190612096565b60405180910390f35b34801561033257600080fd5b5061034d60048036036103489190810190611cb7565b61115c565b60405161035a9190611fc9565b60405180910390f35b34801561036f57600080fd5b5061037861123d565b6040516103859190612119565b60405180910390f35b34801561039a57600080fd5b506103b560048036036103b09190810190611cb7565b611249565b6040516103c29190612119565b60405180910390f35b3480156103d757600080fd5b506103f260048036036103ed9190810190611d7a565b6112c6565b6040516103ff9190612059565b60405180910390f35b34801561041457600080fd5b5061042f600480360361042a9190810190611de6565b611530565b60405161043c9190612119565b60405180910390f35b34801561045157600080fd5b5061046c60048036036104679190810190611d39565b611599565b6040516104799190612074565b60405180910390f35b34801561048e57600080fd5b506104a960048036036104a49190810190611d39565b6116ab565b6040516104b69190611fc9565b60405180910390f35b6000806001018054905082109050919050565b60008060008001846040518082805190602001908083835b60208310151561050f57805182526020820191506020810190506020830392506104ea565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020600001549050600081111561073057600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bf6f217a6040805190810160405280600681526020017f4d4f4449465900000000000000000000000000000000000000000000000000008152508660008001886040518082805190602001908083835b60208310151561060057805182526020820191506020810190506020830392506105db565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390206001016040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401610670939291906120cd565b600060405180830381600087803b15801561068a57600080fd5b505af115801561069e573d6000803e3d6000fd5b505050508260008001856040518082805190602001908083835b6020831015156106dd57805182526020820191506020810190506020830392506106b8565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390206001019080519060200190610726929190611953565b5060019150610898565b8260008001856040518082805190602001908083835b60208310151561076b5780518252602082019150602081019050602083039250610746565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060010190805190602001906107b4929190611953565b50600060010180548091906001016107cc91906119d3565b90506001810160008001856040518082805190602001908083835b60208310151561080c57805182526020820191506020810190506020830392506107e7565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020600001819055508360006001018281548110151561085957fe5b9060005260206000209060020201600001908051906020019061087d929190611953565b50600060020160008154809291906001019190505550600091505b5092915050565b60006108ca7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff611530565b905090565b60008060008001846040518082805190602001908083835b60208310151561090c57805182526020820191506020810190506020830392506108e7565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060000154905060008111156109575760009150610abf565b8260008001856040518082805190602001908083835b602083101515610992578051825260208201915060208101905060208303925061096d565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060010190805190602001906109db929190611953565b50600060010180548091906001016109f391906119d3565b90506001810160008001856040518082805190602001908083835b602083101515610a335780518252602082019150602081019050602083039250610a0e565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390206000018190555083600060010182815481101515610a8057fe5b90600052602060002090600202016000019080519060200190610aa4929190611953565b50600060020160008154809291906001019190505550600191505b5092915050565b60606000606080610ad561089f565b92505b610ae1836104bf565b15610b1b57610aef83610f8b565b91509150610afd8483611782565b9350610b098482611782565b9350610b1483611530565b9250610ad8565b50505090565b606060008060008060608060028802604051908082528060200260200182016040528015610b6357816020015b6060815260200190600190039081610b4e5790505b509650600093506000925060009550600094508893505b610b83846104bf565b15610c1b57610b9184610f8b565b91509150818784815181101515610ba457fe5b90602001906020020181905250808760018501815181101515610bc357fe5b9060200190602002018190525060028301925085806001019650508786101515610c0b57610bf084611530565b9450610bfb856104bf565b1515610c0657600094505b610c1b565b610c1484611530565b9350610b7a565b505050509250925092565b6060600080610c3d6000610c3861123d565b610b21565b809350819450829550505050509091565b60008060008001836040518082805190602001908083835b602083101515610c8b5780518252602082019150602081019050602083039250610c66565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390206000015490506000811415610cd65760009150610f09565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bf6f217a6040805190810160405280600681526020017f44454c45544500000000000000000000000000000000000000000000000000008152508560008001876040518082805190602001908083835b602083101515610d855780518252602082019150602081019050602083039250610d60565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390206001016040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401610df5939291906120cd565b600060405180830381600087803b158015610e0f57600080fd5b505af1158015610e23573d6000803e3d6000fd5b5050505060008001836040518082805190602001908083835b602083101515610e615780518252602082019150602081019050602083039250610e3c565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020600080820160009055600182016000610ead9190611a05565b50506001600060010160018303815481101515610ec657fe5b906000526020600020906002020160010160006101000a81548160ff02191690831515021790555060006002016000815480929190600190039190505550600191505b50919050565b60008060008001836040518082805190602001908083835b602083101515610f4c5780518252602082019150602081019050602083039250610f27565b6001836020036101000a03801982511681845116808217","8552505050505050905001915050908152602001604051809103902060000154119050919050565b606080600060010183815481101515610fa057fe5b90600052602060002090600202016000018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156110455780601f1061101a57610100808354040283529160200191611045565b820191906000526020600020905b81548152906001019060200180831161102857829003601f168201915b5050505050915060008001826040518082805190602001908083835b6020831015156110865780518252602082019150602081019050602083039250611061565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390206001018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156111505780601f1061112557610100808354040283529160200191611150565b820191906000526020600020905b81548152906001019060200180831161113357829003601f168201915b50505050509050915091565b60606000806060845192506002830260405190808252806020026020018201604052801561119e57816020015b60608152602001906001900390816111895790505b509350600091505b82821015611235576111ce85838151811015156111bf57fe5b90602001906020020151611599565b905084828151811015156111de57fe5b9060200190602002015184600284028151811015156111f957fe5b9060200190602002018190525080846001600285020181518110151561121b57fe5b9060200190602002018190525081806001019250506111a6565b505050919050565b60008060020154905090565b60008060008084519250600091505b828210156112be5761129b858381518110151561127157fe5b90602001906020020151866001850181518110151561128c57fe5b906020019060200201516104d2565b90506001151581151514156112b35783806001019450505b600282019150611258565b505050919050565b60008060008001846040518082805190602001908083835b60208310151561130357805182526020820191506020810190506020830392506112de565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020600001549050600081111561152457600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bf6f217a6040805190810160405280600681526020017f4d4f4449465900000000000000000000000000000000000000000000000000008152508660008001886040518082805190602001908083835b6020831015156113f457805182526020820191506020810190506020830392506113cf565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390206001016040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401611464939291906120cd565b600060405180830381600087803b15801561147e57600080fd5b505af1158015611492573d6000803e3d6000fd5b505050508260008001856040518082805190602001908083835b6020831015156114d157805182526020820191506020810190506020830392506114ac565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020600101908051906020019061151a929190611953565b5060019150611529565b600091505b5092915050565b600081806001019250505b6000600101805490508210801561157f575060006001018281548110151561155f57fe5b906000526020600020906002020160010160009054906101000a900460ff165b1561159157818060010192505061153b565b819050919050565b606060008001826040518082805190602001908083835b6020831015156115d557805182526020820191506020810190506020830392506115b0565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390206001018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561169f5780601f106116745761010080835404028352916020019161169f565b820191906000526020600020905b81548152906001019060200180831161168257829003601f168201915b50505050509050919050565b6060600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d7ecbbcc836040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016117249190612074565b600060405180830381600087803b15801561173e57600080fd5b505af1158015611752573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525061177b9190810190611cf8565b9050919050565b606080606080606060008088955087945084518651016040519080825280601f01601f1916602001820160405280156117ca5781602001602082028038833980820191505090505b50935083925060009150600090505b855181101561188c5785818151811015156117f057fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f010000000000000000000000000000000000000000000000000000000000000002838380600101945081518110151561184f57fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080806001019150506117d9565b600090505b84518110156119445784818151811015156118a857fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f010000000000000000000000000000000000000000000000000000000000000002838380600101945081518110151561190757fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508080600101915050611891565b83965050505050505092915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061199457805160ff19168380011785556119c2565b828001600101855582156119c2579182015b828111156119c15782518255916020019190600101906119a6565b5b5090506119cf9190611a4d565b5090565b815481835581811115611a00576002028160020283600052602060002091820191016119ff9190611a72565b5b505050565b50805460018160011615610100020316600290046000825580601f10611a2b5750611a4a565b601f016020900490600052602060002090810190611a499190611a4d565b5b50565b611a6f91905b80821115611a6b576000816000905550600101611a53565b5090565b90565b611ab291905b80821115611aae5760008082016000611a919190611a05565b6001820160006101000a81549060ff021916905550600201611a78565b5090565b90565b600082601f8301121515611ac857600080fd5b8135611adb611ad682612161565b612134565b9150818183526020840193506020810190508360005b83811015611b215781358601611b078882611ba1565b845260208401935060208301925050600181019050611af1565b5050505092915050565b600082601f8301121515611b3e57600080fd5b8151611b51611b4c82612161565b612134565b9150818183526020840193506020810190508360005b83811015611b975781518601611b7d8882611bf7565b845260208401935060208301925050600181019050611b67565b5050505092915050565b600082601f8301121515611bb457600080fd5b8135611bc7611bc282612189565b612134565b91508082526020830160208301858383011115611be357600080fd5b611bee83828461224e565b50505092915050565b600082601f8301121515611c0a57600080fd5b8151611c1d611c1882612189565b612134565b91508082526020830160208301858383011115611c3957600080fd5b611c4483828461225d565b50505092915050565b600082601f8301121515611c6057600080fd5b8135611c73611c6e826121b5565b612134565b91508082526020830160208301858383011115611c8f57600080fd5b611c9a83828461224e565b50505092915050565b6000611caf8235612244565b905092915050565b600060208284031215611cc957600080fd5b600082013567ffffffffffffffff811115611ce357600080fd5b611cef84828501611ab5565b91505092915050565b600060208284031215611d0a57600080fd5b600082015167ffffffffffffffff811115611d2457600080fd5b611d3084828501611b2b565b91505092915050565b600060208284031215611d4b57600080fd5b600082013567ffffffffffffffff811115611d6557600080fd5b611d7184828501611c4d565b91505092915050565b60008060408385031215611d8d57600080fd5b600083013567ffffffffffffffff811115611da757600080fd5b611db385828601611c4d565b925050602083013567ffffffffffffffff811115611dd057600080fd5b611ddc85828601611c4d565b9150509250929050565b600060208284031215611df857600080fd5b6000611e0684828501611ca3565b91505092915050565b60008060408385031215611e2257600080fd5b6000611e3085828601611ca3565b9250506020611e4185828601611ca3565b9150509250929050565b6000611e5682612200565b80845260208401935083602082028501611e6f856121e1565b60005b84811015611ea8578383038852611e8a838351611efe565b9250611e9582612221565b9150602088019750600181019050611e72565b508196508694505050505092915050565b611ec28161222e565b82525050565b6000611ed382612216565b808452611ee781602086016020860161225d565b611ef081612290565b602085010191505092915050565b6000611f098261220b565b808452611f1d81602086016020860161225d565b611f2681612290565b602085010191505092915050565b600081546001811660008114611f515760018114611f7157611fb2565b607f600283041680865260ff198316602087","015260408601935050611fb2565b60028204808652602086019550611f87856121ee565b60005b82811015611fa957815481890152600182019150602081019050611f8a565b80880195505050505b505092915050565b611fc38161223a565b82525050565b60006020820190508181036000830152611fe38184611e4b565b905092915050565b600060408201905081810360008301526120058185611e4b565b90506120146020830184611fba565b9392505050565b600060608201905081810360008301526120358186611e4b565b90506120446020830185611fba565b6120516040830184611fba565b949350505050565b600060208201905061206e6000830184611eb9565b92915050565b6000602082019050818103600083015261208e8184611ec8565b905092915050565b600060408201905081810360008301526120b08185611ec8565b905081810360208301526120c48184611ec8565b90509392505050565b600060608201905081810360008301526120e78186611efe565b905081810360208301526120fb8185611ec8565b9050818103604083015261210f8184611f34565b9050949350505050565b600060208201905061212e6000830184611fba565b92915050565b6000604051905081810181811067ffffffffffffffff8211171561215757600080fd5b8060405250919050565b600067ffffffffffffffff82111561217857600080fd5b602082029050602081019050919050565b600067ffffffffffffffff8211156121a057600080fd5b601f19601f8301169050602081019050919050565b600067ffffffffffffffff8211156121cc57600080fd5b601f19601f8301169050602081019050919050565b6000602082019050919050565b60008160005260206000209050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b60008115159050919050565b6000819050919050565b6000819050919050565b82818337600083830152505050565b60005b8381101561227b578082015181840152602081019050612260565b8381111561228a576000848401525b50505050565b6000601f19601f83011690509190505600a265627a7a72305820dd4bacaf0c1a2ff83e30b0be5b943a94c485cb1b0a7cb6dce16938b6ef3729096c6578706572696d656e74616cf50037608060405234801561001057600080fd5b506108ab806100206000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063bf6f217a14610051578063d7ecbbcc1461007a575b600080fd5b34801561005d57600080fd5b5061007860048036036100739190810190610638565b6100b7565b005b34801561008657600080fd5b506100a1600480360361009c91908101906105f7565b6101e0565b6040516100ae9190610773565b60405180910390f35b6000806000846040518082805190602001908083835b6020831015156100f257805182526020820191506020810190506020830392506100cd565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902091508481600001908051906020019061013f929190610475565b5082816001019080519060200190610158929190610475565b50818190806001815401808255809150509060018203906000526020600020906002020160009091929091909150600082018160000190805460018160011615610100020316600290046101ad9291906104f5565b50600182018160010190805460018160011615610100020316600290046101d59291906104f5565b505050505050505050565b6060600080600080856040518082805190602001908083835b60208310151561021e57805182526020820191506020810190506020830392506101f9565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390209250828054905091506000821115156102695761046d565b600282026040519080825280602002602001820160405280156102a057816020015b606081526020019060019003908161028b5790505b509350600090505b8181101561046c5782818154811015156102be57fe5b90600052602060002090600202016000018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156103635780601f1061033857610100808354040283529160200191610363565b820191906000526020600020905b81548152906001019060200180831161034657829003601f168201915b5050505050846002830281518110151561037957fe5b90602001906020020181905250828181548110151561039457fe5b90600052602060002090600202016001018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104395780601f1061040e57610100808354040283529160200191610439565b820191906000526020600020905b81548152906001019060200180831161041c57829003601f168201915b5050505050846001600284020181518110151561045257fe5b9060200190602002018190525080806001019150506102a8565b5b505050919050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106104b657805160ff19168380011785556104e4565b828001600101855582156104e4579182015b828111156104e35782518255916020019190600101906104c8565b5b5090506104f1919061057c565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061052e578054855561056b565b8280016001018555821561056b57600052602060002091601f016020900482015b8281111561056a57825482559160010191906001019061054f565b5b509050610578919061057c565b5090565b61059e91905b8082111561059a576000816000905550600101610582565b5090565b90565b600082601f83011215156105b457600080fd5b81356105c76105c2826107c2565b610795565b915080825260208301602083018583830111156105e357600080fd5b6105ee83828461081e565b50505092915050565b60006020828403121561060957600080fd5b600082013567ffffffffffffffff81111561062357600080fd5b61062f848285016105a1565b91505092915050565b60008060006060848603121561064d57600080fd5b600084013567ffffffffffffffff81111561066757600080fd5b610673868287016105a1565b935050602084013567ffffffffffffffff81111561069057600080fd5b61069c868287016105a1565b925050604084013567ffffffffffffffff8111156106b957600080fd5b6106c5868287016105a1565b9150509250925092565b60006106da826107fb565b808452602084019350836020820285016106f3856107ee565b60005b8481101561072c57838303885261070e83835161073d565b925061071982610811565b91506020880197506001810190506106f6565b508196508694505050505092915050565b600061074882610806565b80845261075c81602086016020860161082d565b61076581610860565b602085010191505092915050565b6000602082019050818103600083015261078d81846106cf565b905092915050565b6000604051905081810181811067ffffffffffffffff821117156107b857600080fd5b8060405250919050565b600067ffffffffffffffff8211156107d957600080fd5b601f19601f8301169050602081019050919050565b6000602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b82818337600083830152505050565b60005b8381101561084b578082015181840152602081019050610830565b8381111561085a576000848401525b50505050565b6000601f19601f83011690509190505600a265627a7a723058205adfecd049ee5abedb424dd2ee6850f13c0fc182178ab51b1e460d4d0e3746d46c6578706572696d656e74616cf50037"};

    public static final String BINARY = org.fisco.bcos.sdk.utils.StringUtils.joinAll("", BINARY_ARRAY);

    public static final String[] SM_BINARY_ARRAY = {"608060405234801561001057600080fd5b5061001961007b565b604051809103906000f080158015610035573d6000803e3d6000fd5b50600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061008c565b6040516108cb806200237783390190565b6122db806200009c6000396000f3006080604052600436106100f1576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063104e7dfc146100f65780633055ae81146101355780633aae36c214610172578063440ace66146101b05780634cabbe1c146101db5780635772ded21461021857806361e020cb14610255578063670421dd1461029257806367205e04146102cf5780637e6f287c146102fb57806395c5ad8014610338578063a4fd771114610375578063ab993c5e146103b2578063ad07c37a146103ef578063c5b7353d1461042c578063d3e9af5a14610457578063f768225714610482575b600080fd5b34801561010257600080fd5b5061011d60048036036101189190810190611e0f565b6104bf565b60405161012c9392919061201b565b60405180910390f35b34801561014157600080fd5b5061015c60048036036101579190810190611d39565b6105c4565b6040516101699190612074565b60405180910390f35b34801561017e57600080fd5b5061019960048036036101949190810190611de6565b6106d6565b6040516101a7929190612096565b60405180910390f35b3480156101bc57600080fd5b506101c56108a7565b6040516101d29190612119565b60405180910390f35b3480156101e757600080fd5b5061020260048036036101fd9190810190611de6565b6108d7565b60405161020f9190612059565b60405180910390f35b34801561022457600080fd5b5061023f600480360361023a9190810190611cb7565b6108ea565b60405161024c9190611fc9565b60405180910390f35b34801561026157600080fd5b5061027c60048036036102779190810190611d7a565b6109cb565b6040516102899190612059565b60405180910390f35b34801561029e57600080fd5b506102b960048036036102b49190810190611d39565b610d98565b6040516102c69190612059565b60405180910390f35b3480156102db57600080fd5b506102e4610e14565b6040516102f2929190611feb565b60405180910390f35b34801561030757600080fd5b50610322600480360361031d9190810190611d39565b610e3c565b60405161032f9190612059565b60405180910390f35b34801561034457600080fd5b5061035f600480360361035a9190810190611de6565b6110fd565b60405161036c9190612119565b60405180910390f35b34801561038157600080fd5b5061039c60048036036103979190810190611d7a565b611166565b6040516103a99190612059565b60405180910390f35b3480156103be57600080fd5b506103d960048036036103d49190810190611cb7565b61135d565b6040516103e69190612119565b60405180910390f35b3480156103fb57600080fd5b5061041660048036036104119190810190611d7a565b6113da565b6040516104239190612059565b60405180910390f35b34801561043857600080fd5b50610441611644565b60405161044e9190612074565b60405180910390f35b34801561046357600080fd5b5061046c61169f565b6040516104799190612119565b60405180910390f35b34801561048e57600080fd5b506104a960048036036104a49190810190611d39565b6116ab565b6040516104b69190611fc9565b60405180910390f35b60606000806000806060806002880260405190808252806020026020018201604052801561050157816020015b60608152602001906001900390816104ec5790505b509650600093506000925060009550600094508893505b610521846108d7565b156105b95761052f846106d6565b9150915081878481518110151561054257fe5b9060200190602002018190525080876001850181518110151561056157fe5b90602001906020020181905250600283019250858060010196505087861015156105a95761058e846110fd565b9450610599856108d7565b15156105a457600094505b6105b9565b6105b2846110fd565b9350610518565b505050509250925092565b606060008001826040518082805190602001908083835b60208310151561060057805182526020820191506020810190506020830392506105db565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390206001018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106ca5780601f1061069f576101008083540402835291602001916106ca565b820191906000526020600020905b8154815290600101906020018083116106ad57829003601f168201915b50505050509050919050565b6060806000600101838154811015156106eb57fe5b90600052602060002090600202016000018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107905780601f1061076557610100808354040283529160200191610790565b820191906000526020600020905b81548152906001019060200180831161077357829003601f168201915b5050505050915060008001826040518082805190602001908083835b6020831015156107d157805182526020820191506020810190506020830392506107ac565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390206001018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561089b5780601f106108705761010080835404028352916020019161089b565b820191906000526020600020905b81548152906001019060200180831161087e57829003601f168201915b50505050509050915091565b60006108d27fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6110fd565b905090565b6000806001018054905082109050919050565b60606000806060845192506002830260405190808252806020026020018201604052801561092c57816020015b60608152602001906001900390816109175790505b509350600091505b828210156109c35761095c858381518110151561094d57fe5b906020019060200201516105c4565b9050848281518110151561096c57fe5b90602001906020020151846002840281518110151561098757fe5b906020019060200201819052508084600160028502018151811015156109a957fe5b906020019060200201819052508180600101925050610934565b505050919050565b60008060008001846040518082805190602001908083835b602083101515610a0857805182526020820191506020810190506020830392506109e3565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390206000015490506000811115610c2957600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166314062fe26040805190810160405280600681526020017f4d4f4449465900000000000000000000000000000000000000000000000000008152508660008001886040518082805190602001908083835b602083101515610af95780518252602082019150602081019050602083039250610ad4565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390206001016040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401610b69939291906120cd565b600060405180830381600087803b158015610b8357600080fd5b505af1158015610b97573d6000803e3d6000fd5b505050508260008001856040518082805190602001908083835b602083101515610bd65780518252602082019150602081019050602083039250610bb1565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390206001019080519060200190610c1f929190611953565b5060019150610d91565b8260008001856040518082805190602001908083835b602083101515610c645780518252602082019150602081019050602083039250610c3f565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390206001019080519060200190610cad929190611953565b5060006001018054809190600101610cc591906119d3565b90506001810160008001856040518082805190602001908083835b602083101515610d055780518252602082019150602081019050602083039250610ce0565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390206000018190555083600060010182815481101515610d5257fe5b90600052602060002090600202016000019080519060200190610d76929190611953565b50600060020160008154809291906001019190505550600091505b5092915050565b60008060008001836040518082805190602001908083835b602083101515610dd55780518252602082019150602081019050602083039250610db0565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060000154119050919050565b6060600080610e2b6000610e2661169f565b6104bf565b809350819450829550505050509091565b60008060008001836040518082805190602001908083835b602083101515610e795780518252602082019150602081019050602083039250610e54565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390206000015490506000811415610ec457600091506110f7565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166314062fe26040805190810160405280600681526020017f44454c45544500000000000000000000000000000000000000000000000000008152508560008001876040518082805190602001908083835b602083101515610f73578051825260208201915060","2081019050602083039250610f4e565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390206001016040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401610fe3939291906120cd565b600060405180830381600087803b158015610ffd57600080fd5b505af1158015611011573d6000803e3d6000fd5b5050505060008001836040518082805190602001908083835b60208310151561104f578051825260208201915060208101905060208303925061102a565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060008082016000905560018201600061109b9190611a05565b505060016000600101600183038154811015156110b457fe5b906000526020600020906002020160010160006101000a81548160ff02191690831515021790555060006002016000815480929190600190039190505550600191505b50919050565b600081806001019250505b6000600101805490508210801561114c575060006001018281548110151561112c57fe5b906000526020600020906002020160010160009054906101000a900460ff165b1561115e578180600101925050611108565b819050919050565b60008060008001846040518082805190602001908083835b6020831015156111a3578051825260208201915060208101905060208303925061117e565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060000154905060008111156111ee5760009150611356565b8260008001856040518082805190602001908083835b6020831015156112295780518252602082019150602081019050602083039250611204565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390206001019080519060200190611272929190611953565b506000600101805480919060010161128a91906119d3565b90506001810160008001856040518082805190602001908083835b6020831015156112ca57805182526020820191506020810190506020830392506112a5565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020600001819055508360006001018281548110151561131757fe5b9060005260206000209060020201600001908051906020019061133b929190611953565b50600060020160008154809291906001019190505550600191505b5092915050565b60008060008084519250600091505b828210156113d2576113af858381518110151561138557fe5b9060200190602002015186600185018151811015156113a057fe5b906020019060200201516109cb565b90506001151581151514156113c75783806001019450505b60028201915061136c565b505050919050565b60008060008001846040518082805190602001908083835b60208310151561141757805182526020820191506020810190506020830392506113f2565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020600001549050600081111561163857600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166314062fe26040805190810160405280600681526020017f4d4f4449465900000000000000000000000000000000000000000000000000008152508660008001886040518082805190602001908083835b60208310151561150857805182526020820191506020810190506020830392506114e3565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390206001016040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401611578939291906120cd565b600060405180830381600087803b15801561159257600080fd5b505af11580156115a6573d6000803e3d6000fd5b505050508260008001856040518082805190602001908083835b6020831015156115e557805182526020820191506020810190506020830392506115c0565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020600101908051906020019061162e929190611953565b506001915061163d565b600091505b5092915050565b606060006060806116536108a7565b92505b61165f836108d7565b156116995761166d836106d6565b9150915061167b8483611782565b93506116878482611782565b9350611692836110fd565b9250611656565b50505090565b60008060020154905090565b6060600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f7682257836040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016117249190612074565b600060405180830381600087803b15801561173e57600080fd5b505af1158015611752573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525061177b9190810190611cf8565b9050919050565b606080606080606060008088955087945084518651016040519080825280601f01601f1916602001820160405280156117ca5781602001602082028038833980820191505090505b50935083925060009150600090505b855181101561188c5785818151811015156117f057fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f010000000000000000000000000000000000000000000000000000000000000002838380600101945081518110151561184f57fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080806001019150506117d9565b600090505b84518110156119445784818151811015156118a857fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f010000000000000000000000000000000000000000000000000000000000000002838380600101945081518110151561190757fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508080600101915050611891565b83965050505050505092915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061199457805160ff19168380011785556119c2565b828001600101855582156119c2579182015b828111156119c15782518255916020019190600101906119a6565b5b5090506119cf9190611a4d565b5090565b815481835581811115611a00576002028160020283600052602060002091820191016119ff9190611a72565b5b505050565b50805460018160011615610100020316600290046000825580601f10611a2b5750611a4a565b601f016020900490600052602060002090810190611a499190611a4d565b5b50565b611a6f91905b80821115611a6b576000816000905550600101611a53565b5090565b90565b611ab291905b80821115611aae5760008082016000611a919190611a05565b6001820160006101000a81549060ff021916905550600201611a78565b5090565b90565b600082601f8301121515611ac857600080fd5b8135611adb611ad682612161565b612134565b9150818183526020840193506020810190508360005b83811015611b215781358601611b078882611ba1565b845260208401935060208301925050600181019050611af1565b5050505092915050565b600082601f8301121515611b3e57600080fd5b8151611b51611b4c82612161565b612134565b9150818183526020840193506020810190508360005b83811015611b975781518601611b7d8882611bf7565b845260208401935060208301925050600181019050611b67565b5050505092915050565b600082601f8301121515611bb457600080fd5b8135611bc7611bc282612189565b612134565b91508082526020830160208301858383011115611be357600080fd5b611bee83828461224e565b50505092915050565b600082601f8301121515611c0a57600080fd5b8151611c1d611c1882612189565b612134565b91508082526020830160208301858383011115611c3957600080fd5b611c4483828461225d565b50505092915050565b600082601f8301121515611c6057600080fd5b8135611c73611c6e826121b5565b612134565b91508082526020830160208301858383011115611c8f57600080fd5b611c9a83828461224e565b50505092915050565b6000611caf8235612244565b905092915050565b600060208284031215611cc957600080fd5b600082013567ffffffffffffffff811115611ce357600080fd5b611cef84828501611ab5565b91505092915050565b600060208284031215611d0a57600080fd5b600082015167ffffffffffffffff811115611d2457600080fd5b611d3084828501611b2b565b91505092915050565b600060208284031215611d4b57600080fd5b600082013567ffffffffffffffff811115611d6557600080fd5b611d7184828501611c4d565b91505092915050565b60008060408385031215611d8d57600080fd5b600083013567ffffffffffffffff811115611da757600080fd5b611db385828601611c4d565b925050602083013567ffffffffffffffff811115611dd057600080fd5b611ddc85828601611c4d565b9150509250929050565b600060208284031215611df857600080fd5b6000611e0684828501611ca3565b91505092915050565b60008060408385031215611e2257600080fd5b6000611e3085828601611ca3565b9250506020611e4185828601611ca3565b9150509250929050565b6000611e5682612200565b80845260208401935083602082028501611e6f856121e1565b60005b84811015611ea8578383038852611e8a838351611efe565b9250611e9582612221565b9150602088019750600181019050611e72565b508196508694505050505092915050565b611ec28161222e565b82525050565b6000611ed382612216565b808452611ee781602086016020860161225d565b611ef081612290565b602085010191505092915050565b6000611f098261220b565b808452611f1d81602086016020860161225d565b611f2681612290565b602085010191505092915050565b600081546001811660008114611f515760018114611f7157611fb2565b607f600283041680865260ff198316602087","015260408601935050611fb2565b60028204808652602086019550611f87856121ee565b60005b82811015611fa957815481890152600182019150602081019050611f8a565b80880195505050505b505092915050565b611fc38161223a565b82525050565b60006020820190508181036000830152611fe38184611e4b565b905092915050565b600060408201905081810360008301526120058185611e4b565b90506120146020830184611fba565b9392505050565b600060608201905081810360008301526120358186611e4b565b90506120446020830185611fba565b6120516040830184611fba565b949350505050565b600060208201905061206e6000830184611eb9565b92915050565b6000602082019050818103600083015261208e8184611ec8565b905092915050565b600060408201905081810360008301526120b08185611ec8565b905081810360208301526120c48184611ec8565b90509392505050565b600060608201905081810360008301526120e78186611efe565b905081810360208301526120fb8185611ec8565b9050818103604083015261210f8184611f34565b9050949350505050565b600060208201905061212e6000830184611fba565b92915050565b6000604051905081810181811067ffffffffffffffff8211171561215757600080fd5b8060405250919050565b600067ffffffffffffffff82111561217857600080fd5b602082029050602081019050919050565b600067ffffffffffffffff8211156121a057600080fd5b601f19601f8301169050602081019050919050565b600067ffffffffffffffff8211156121cc57600080fd5b601f19601f8301169050602081019050919050565b6000602082019050919050565b60008160005260206000209050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b60008115159050919050565b6000819050919050565b6000819050919050565b82818337600083830152505050565b60005b8381101561227b578082015181840152602081019050612260565b8381111561228a576000848401525b50505050565b6000601f19601f83011690509190505600a265627a7a723058209ee3b03418f8eecc33a9cf3094194b917b818e7bb8eef85ec15369afb318a26c6c6578706572696d656e74616cf50037608060405234801561001057600080fd5b506108ab806100206000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806314062fe214610051578063f76822571461007a575b600080fd5b34801561005d57600080fd5b5061007860048036036100739190810190610638565b6100b7565b005b34801561008657600080fd5b506100a1600480360361009c91908101906105f7565b6101e0565b6040516100ae9190610773565b60405180910390f35b6000806000846040518082805190602001908083835b6020831015156100f257805182526020820191506020810190506020830392506100cd565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902091508481600001908051906020019061013f929190610475565b5082816001019080519060200190610158929190610475565b50818190806001815401808255809150509060018203906000526020600020906002020160009091929091909150600082018160000190805460018160011615610100020316600290046101ad9291906104f5565b50600182018160010190805460018160011615610100020316600290046101d59291906104f5565b505050505050505050565b6060600080600080856040518082805190602001908083835b60208310151561021e57805182526020820191506020810190506020830392506101f9565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390209250828054905091506000821115156102695761046d565b600282026040519080825280602002602001820160405280156102a057816020015b606081526020019060019003908161028b5790505b509350600090505b8181101561046c5782818154811015156102be57fe5b90600052602060002090600202016000018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156103635780601f1061033857610100808354040283529160200191610363565b820191906000526020600020905b81548152906001019060200180831161034657829003601f168201915b5050505050846002830281518110151561037957fe5b90602001906020020181905250828181548110151561039457fe5b90600052602060002090600202016001018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104395780601f1061040e57610100808354040283529160200191610439565b820191906000526020600020905b81548152906001019060200180831161041c57829003601f168201915b5050505050846001600284020181518110151561045257fe5b9060200190602002018190525080806001019150506102a8565b5b505050919050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106104b657805160ff19168380011785556104e4565b828001600101855582156104e4579182015b828111156104e35782518255916020019190600101906104c8565b5b5090506104f1919061057c565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061052e578054855561056b565b8280016001018555821561056b57600052602060002091601f016020900482015b8281111561056a57825482559160010191906001019061054f565b5b509050610578919061057c565b5090565b61059e91905b8082111561059a576000816000905550600101610582565b5090565b90565b600082601f83011215156105b457600080fd5b81356105c76105c2826107c2565b610795565b915080825260208301602083018583830111156105e357600080fd5b6105ee83828461081e565b50505092915050565b60006020828403121561060957600080fd5b600082013567ffffffffffffffff81111561062357600080fd5b61062f848285016105a1565b91505092915050565b60008060006060848603121561064d57600080fd5b600084013567ffffffffffffffff81111561066757600080fd5b610673868287016105a1565b935050602084013567ffffffffffffffff81111561069057600080fd5b61069c868287016105a1565b925050604084013567ffffffffffffffff8111156106b957600080fd5b6106c5868287016105a1565b9150509250925092565b60006106da826107fb565b808452602084019350836020820285016106f3856107ee565b60005b8481101561072c57838303885261070e83835161073d565b925061071982610811565b91506020880197506001810190506106f6565b508196508694505050505092915050565b600061074882610806565b80845261075c81602086016020860161082d565b61076581610860565b602085010191505092915050565b6000602082019050818103600083015261078d81846106cf565b905092915050565b6000604051905081810181811067ffffffffffffffff821117156107b857600080fd5b8060405250919050565b600067ffffffffffffffff8211156107d957600080fd5b601f19601f8301169050602081019050919050565b6000602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b82818337600083830152505050565b60005b8381101561084b578082015181840152602081019050610830565b8381111561085a576000848401525b50505050565b6000601f19601f83011690509190505600a265627a7a723058202b231cdc63cb8ca5b95e5d2cb314851efb40e5cff33c4912aed9cc7fd50829ef6c6578706572696d656e74616cf50037"};

    public static final String SM_BINARY = org.fisco.bcos.sdk.utils.StringUtils.joinAll("", SM_BINARY_ARRAY);

    public static final String[] ABI_ARRAY = {"[{\"constant\":true,\"inputs\":[{\"name\":\"keyIndex\",\"type\":\"uint256\"}],\"name\":\"iterate_valid\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"key\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"}],\"name\":\"insert\",\"outputs\":[{\"name\":\"replaced\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"iterate_start\",\"outputs\":[{\"name\":\"keyIndex\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"key\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"}],\"name\":\"add\",\"outputs\":[{\"name\":\"ret\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"toStr\",\"outputs\":[{\"name\":\"s\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"start\",\"type\":\"uint256\"},{\"name\":\"num\",\"type\":\"uint256\"}],\"name\":\"getByIndex\",\"outputs\":[{\"name\":\"kvList\",\"type\":\"bytes[]\"},{\"name\":\"retNum\",\"type\":\"uint256\"},{\"name\":\"nextIndex\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getAll\",\"outputs\":[{\"name\":\"kvList\",\"type\":\"bytes[]\"},{\"name\":\"retNum\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"key\",\"type\":\"bytes\"}],\"name\":\"remove\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"key\",\"type\":\"bytes\"}],\"name\":\"contains\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"keyIndex\",\"type\":\"uint256\"}],\"name\":\"iterate_get\",\"outputs\":[{\"name\":\"key\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"keys\",\"type\":\"bytes[]\"}],\"name\":\"getBatch\",\"outputs\":[{\"name\":\"kvList\",\"type\":\"bytes[]\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"size\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"kvList\",\"type\":\"bytes[]\"}],\"name\":\"insertBatch\",\"outputs\":[{\"name\":\"size\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"key\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"}],\"name\":\"set\",\"outputs\":[{\"name\":\"ret\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"keyIndex\",\"type\":\"uint256\"}],\"name\":\"iterate_next\",\"outputs\":[{\"name\":\"r_keyIndex\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"key\",\"type\":\"bytes\"}],\"name\":\"get\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"key\",\"type\":\"bytes\"}],\"name\":\"getHistory\",\"outputs\":[{\"name\":\"results\",\"type\":\"bytes[]\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"}]"};

    public static final String ABI = org.fisco.bcos.sdk.utils.StringUtils.joinAll("", ABI_ARRAY);

    public static final String FUNC_ITERATE_VALID = "iterate_valid";

    public static final String FUNC_INSERT = "insert";

    public static final String FUNC_ITERATE_START = "iterate_start";

    public static final String FUNC_ADD = "add";

    public static final String FUNC_TOSTR = "toStr";

    public static final String FUNC_GETBYINDEX = "getByIndex";

    public static final String FUNC_GETALL = "getAll";

    public static final String FUNC_REMOVE = "remove";

    public static final String FUNC_CONTAINS = "contains";

    public static final String FUNC_ITERATE_GET = "iterate_get";

    public static final String FUNC_GETBATCH = "getBatch";

    public static final String FUNC_SIZE = "size";

    public static final String FUNC_INSERTBATCH = "insertBatch";

    public static final String FUNC_SET = "set";

    public static final String FUNC_ITERATE_NEXT = "iterate_next";

    public static final String FUNC_GET = "get";

    public static final String FUNC_GETHISTORY = "getHistory";

    protected Storage(String contractAddress, Client client, CryptoKeyPair credential) {
        super(getBinary(client.getCryptoSuite()), contractAddress, client, credential);
    }

    public static String getBinary(CryptoSuite cryptoSuite) {
        return (cryptoSuite.getCryptoTypeConfig() == CryptoType.ECDSA_TYPE ? BINARY : SM_BINARY);
    }

    public Boolean iterate_valid(BigInteger keyIndex) throws ContractException {
        final Function function = new Function(FUNC_ITERATE_VALID, 
                Arrays.<Type>asList(new Uint256(keyIndex)),
                Arrays.<TypeReference<?>>asList(new TypeReference<Bool>() {}));
        return executeCallWithSingleValueReturn(function, Boolean.class);
    }

    public TransactionReceipt insert(byte[] key, byte[] value) {
        final Function function = new Function(
                FUNC_INSERT, 
                Arrays.<Type>asList(new DynamicBytes(key),
                new DynamicBytes(value)),
                Collections.<TypeReference<?>>emptyList());
        return executeTransaction(function);
    }

    public void insert(byte[] key, byte[] value, TransactionCallback callback) {
        final Function function = new Function(
                FUNC_INSERT, 
                Arrays.<Type>asList(new DynamicBytes(key),
                new DynamicBytes(value)),
                Collections.<TypeReference<?>>emptyList());
        asyncExecuteTransaction(function, callback);
    }

    public String getSignedTransactionForInsert(byte[] key, byte[] value) {
        final Function function = new Function(
                FUNC_INSERT, 
                Arrays.<Type>asList(new DynamicBytes(key),
                new DynamicBytes(value)),
                Collections.<TypeReference<?>>emptyList());
        return createSignedTransaction(function);
    }

    public Tuple2<byte[], byte[]> getInsertInput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getInput().substring(10);
        final Function function = new Function(FUNC_INSERT, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<DynamicBytes>() {}, new TypeReference<DynamicBytes>() {}));
        List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple2<byte[], byte[]>(

                (byte[]) results.get(0).getValue(), 
                (byte[]) results.get(1).getValue()
                );
    }

    public Tuple1<Boolean> getInsertOutput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getOutput();
        final Function function = new Function(FUNC_INSERT, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Bool>() {}));
        List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple1<Boolean>(

                (Boolean) results.get(0).getValue()
                );
    }

    public BigInteger iterate_start() throws ContractException {
        final Function function = new Function(FUNC_ITERATE_START, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
        return executeCallWithSingleValueReturn(function, BigInteger.class);
    }

    public TransactionReceipt add(byte[] key, byte[] value) {
        final Function function = new Function(
                FUNC_ADD, 
                Arrays.<Type>asList(new DynamicBytes(key),
                new DynamicBytes(value)),
                Collections.<TypeReference<?>>emptyList());
        return executeTransaction(function);
    }

    public void add(byte[] key, byte[] value, TransactionCallback callback) {
        final Function function = new Function(
                FUNC_ADD, 
                Arrays.<Type>asList(new DynamicBytes(key),
                new DynamicBytes(value)),
                Collections.<TypeReference<?>>emptyList());
        asyncExecuteTransaction(function, callback);
    }

    public String getSignedTransactionForAdd(byte[] key, byte[] value) {
        final Function function = new Function(
                FUNC_ADD, 
                Arrays.<Type>asList(new DynamicBytes(key),
                new DynamicBytes(value)),
                Collections.<TypeReference<?>>emptyList());
        return createSignedTransaction(function);
    }

    public Tuple2<byte[], byte[]> getAddInput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getInput().substring(10);
        final Function function = new Function(FUNC_ADD, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<DynamicBytes>() {}, new TypeReference<DynamicBytes>() {}));
        List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple2<byte[], byte[]>(

                (byte[]) results.get(0).getValue(), 
                (byte[]) results.get(1).getValue()
                );
    }

    public Tuple1<Boolean> getAddOutput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getOutput();
        final Function function = new Function(FUNC_ADD, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Bool>() {}));
        List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple1<Boolean>(

                (Boolean) results.get(0).getValue()
                );
    }

    public byte[] toStr() throws ContractException {
        final Function function = new Function(FUNC_TOSTR, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<DynamicBytes>() {}));
        return executeCallWithSingleValueReturn(function, byte[].class);
    }

    public Tuple3<List<byte[]>, BigInteger, BigInteger> getByIndex(BigInteger start, BigInteger num) throws ContractException {
        final Function function = new Function(FUNC_GETBYINDEX, 
                Arrays.<Type>asList(new Uint256(start),
                new Uint256(num)),
                Arrays.<TypeReference<?>>asList(new TypeReference<DynamicArray<DynamicBytes>>() {}, new TypeReference<Uint256>() {}, new TypeReference<Uint256>() {}));
        List<Type> results = executeCallWithMultipleValueReturn(function);
        return new Tuple3<List<byte[]>, BigInteger, BigInteger>(
                convertToNative((List<DynamicBytes>) results.get(0).getValue()), 
                (BigInteger) results.get(1).getValue(), 
                (BigInteger) results.get(2).getValue());
    }

    public Tuple2<List<byte[]>, BigInteger> getAll() throws ContractException {
        final Function function = new Function(FUNC_GETALL, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<DynamicArray<DynamicBytes>>() {}, new TypeReference<Uint256>() {}));
        List<Type> results = executeCallWithMultipleValueReturn(function);
        return new Tuple2<List<byte[]>, BigInteger>(
                convertToNative((List<DynamicBytes>) results.get(0).getValue()), 
                (BigInteger) results.get(1).getValue());
    }

    public TransactionReceipt remove(byte[] key) {
        final Function function = new Function(
                FUNC_REMOVE, 
                Arrays.<Type>asList(new DynamicBytes(key)),
                Collections.<TypeReference<?>>emptyList());
        return executeTransaction(function);
    }

    public void remove(byte[] key, TransactionCallback callback) {
        final Function function = new Function(
                FUNC_REMOVE, 
                Arrays.<Type>asList(new DynamicBytes(key)),
                Collections.<TypeReference<?>>emptyList());
        asyncExecuteTransaction(function, callback);
    }

    public String getSignedTransactionForRemove(byte[] key) {
        final Function function = new Function(
                FUNC_REMOVE, 
                Arrays.<Type>asList(new DynamicBytes(key)),
                Collections.<TypeReference<?>>emptyList());
        return createSignedTransaction(function);
    }

    public Tuple1<byte[]> getRemoveInput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getInput().substring(10);
        final Function function = new Function(FUNC_REMOVE, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<DynamicBytes>() {}));
        List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple1<byte[]>(

                (byte[]) results.get(0).getValue()
                );
    }

    public Tuple1<Boolean> getRemoveOutput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getOutput();
        final Function function = new Function(FUNC_REMOVE, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Bool>() {}));
        List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple1<Boolean>(

                (Boolean) results.get(0).getValue()
                );
    }

    public Boolean contains(byte[] key) throws ContractException {
        final Function function = new Function(FUNC_CONTAINS, 
                Arrays.<Type>asList(new DynamicBytes(key)),
                Arrays.<TypeReference<?>>asList(new TypeReference<Bool>() {}));
        return executeCallWithSingleValueReturn(function, Boolean.class);
    }

    public Tuple2<byte[], byte[]> iterate_get(BigInteger keyIndex) throws ContractException {
        final Function function = new Function(FUNC_ITERATE_GET, 
                Arrays.<Type>asList(new Uint256(keyIndex)),
                Arrays.<TypeReference<?>>asList(new TypeReference<DynamicBytes>() {}, new TypeReference<DynamicBytes>() {}));
        List<Type> results = executeCallWithMultipleValueReturn(function);
        return new Tuple2<byte[], byte[]>(
                (byte[]) results.get(0).getValue(), 
                (byte[]) results.get(1).getValue());
    }

    public List getBatch(List<byte[]> keys) throws ContractException {
        final Function function = new Function(FUNC_GETBATCH, 
                Arrays.<Type>asList(keys.isEmpty()? DynamicArray.empty("bytes[]"):new DynamicArray<DynamicBytes>(
                        org.fisco.bcos.sdk.abi.Utils.typeMap(keys, DynamicBytes.class))),
                Arrays.<TypeReference<?>>asList(new TypeReference<DynamicArray<DynamicBytes>>() {}));
        List<Type> result = (List<Type>) executeCallWithSingleValueReturn(function, List.class);
        return convertToNative(result);
    }

    public BigInteger size() throws ContractException {
        final Function function = new Function(FUNC_SIZE, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
        return executeCallWithSingleValueReturn(function, BigInteger.class);
    }

    public TransactionReceipt insertBatch(List<byte[]> kvList) {
        final Function function = new Function(
                FUNC_INSERTBATCH, 
                Arrays.<Type>asList(kvList.isEmpty()? DynamicArray.empty("bytes[]"):new DynamicArray<DynamicBytes>(
                        org.fisco.bcos.sdk.abi.Utils.typeMap(kvList, DynamicBytes.class))),
                Collections.<TypeReference<?>>emptyList());
        return executeTransaction(function);
    }

    public void insertBatch(List<byte[]> kvList, TransactionCallback callback) {
        final Function function = new Function(
                FUNC_INSERTBATCH, 
                Arrays.<Type>asList(kvList.isEmpty()? DynamicArray.empty("bytes[]"):new DynamicArray<DynamicBytes>(
                        org.fisco.bcos.sdk.abi.Utils.typeMap(kvList, DynamicBytes.class))),
                Collections.<TypeReference<?>>emptyList());
        asyncExecuteTransaction(function, callback);
    }

    public String getSignedTransactionForInsertBatch(List<byte[]> kvList) {
        final Function function = new Function(
                FUNC_INSERTBATCH, 
                Arrays.<Type>asList(kvList.isEmpty()? DynamicArray.empty("bytes[]"):new DynamicArray<DynamicBytes>(
                        org.fisco.bcos.sdk.abi.Utils.typeMap(kvList, DynamicBytes.class))),
                Collections.<TypeReference<?>>emptyList());
        return createSignedTransaction(function);
    }

    public Tuple1<List<byte[]>> getInsertBatchInput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getInput().substring(10);
        final Function function = new Function(FUNC_INSERTBATCH, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<DynamicArray<DynamicBytes>>() {}));
        List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple1<List<byte[]>>(

                convertToNative((List<DynamicBytes>) results.get(0).getValue())
                );
    }

    public Tuple1<BigInteger> getInsertBatchOutput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getOutput();
        final Function function = new Function(FUNC_INSERTBATCH, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
        List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple1<BigInteger>(

                (BigInteger) results.get(0).getValue()
                );
    }

    public TransactionReceipt set(byte[] key, byte[] value) {
        final Function function = new Function(
                FUNC_SET, 
                Arrays.<Type>asList(new DynamicBytes(key),
                new DynamicBytes(value)),
                Collections.<TypeReference<?>>emptyList());
        return executeTransaction(function);
    }

    public void set(byte[] key, byte[] value, TransactionCallback callback) {
        final Function function = new Function(
                FUNC_SET, 
                Arrays.<Type>asList(new DynamicBytes(key),
                new DynamicBytes(value)),
                Collections.<TypeReference<?>>emptyList());
        asyncExecuteTransaction(function, callback);
    }

    public String getSignedTransactionForSet(byte[] key, byte[] value) {
        final Function function = new Function(
                FUNC_SET, 
                Arrays.<Type>asList(new DynamicBytes(key),
                new DynamicBytes(value)),
                Collections.<TypeReference<?>>emptyList());
        return createSignedTransaction(function);
    }

    public Tuple2<byte[], byte[]> getSetInput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getInput().substring(10);
        final Function function = new Function(FUNC_SET, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<DynamicBytes>() {}, new TypeReference<DynamicBytes>() {}));
        List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple2<byte[], byte[]>(

                (byte[]) results.get(0).getValue(), 
                (byte[]) results.get(1).getValue()
                );
    }

    public Tuple1<Boolean> getSetOutput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getOutput();
        final Function function = new Function(FUNC_SET, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Bool>() {}));
        List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple1<Boolean>(

                (Boolean) results.get(0).getValue()
                );
    }

    public BigInteger iterate_next(BigInteger keyIndex) throws ContractException {
        final Function function = new Function(FUNC_ITERATE_NEXT, 
                Arrays.<Type>asList(new Uint256(keyIndex)),
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
        return executeCallWithSingleValueReturn(function, BigInteger.class);
    }

    public byte[] get(byte[] key) throws ContractException {
        final Function function = new Function(FUNC_GET, 
                Arrays.<Type>asList(new DynamicBytes(key)),
                Arrays.<TypeReference<?>>asList(new TypeReference<DynamicBytes>() {}));
        return executeCallWithSingleValueReturn(function, byte[].class);
    }

    public List getHistory(byte[] key) throws ContractException {
        final Function function = new Function(FUNC_GETHISTORY, 
                Arrays.<Type>asList(new DynamicBytes(key)),
                Arrays.<TypeReference<?>>asList(new TypeReference<DynamicArray<DynamicBytes>>() {}));
        List<Type> result = (List<Type>) executeCallWithSingleValueReturn(function, List.class);
        return convertToNative(result);
    }

    public static Storage load(String contractAddress, Client client, CryptoKeyPair credential) {
        return new Storage(contractAddress, client, credential);
    }

    public static Storage deploy(Client client, CryptoKeyPair credential) throws ContractException {
        return deploy(Storage.class, client, credential, getBinary(client.getCryptoSuite()), "");
    }
}
